<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .f{
            width: 200px;
            height: 200px;
            margin: 100px auto;
            background-color: pink;
        }
        .s {
            width: 100px;
            height: 100px;
            background-color: skyblue;
        }
    </style>
</head>
<body>
    <div class="f">
        <div class="s"></div>
    </div>
    <script>
        var f = document.querySelector('.f');
        var s = document.querySelector('.s');
        // f.addEventListener('click',fn,true)
        // function fn(){
        //     alert('ff')
        // }
        // // 默认为事件冒泡
        // s.addEventListener('click',fn1,true)
        // function fn1(){
        //     alert('ss')
        // }
        f.addEventListener('click',fn,false)
        function fn(){
            alert('ff')
        }
        // 默认为事件冒泡
        s.addEventListener('click',fn1,true)
        function fn1(e){
            e.stopPropagation();
            // e.cancelBubble =  true 停止事件冒泡
            alert('ss')
        }
    </script>
</body>
</html>